﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel;
using System.ServiceModel.Channels;

namespace Samples.RequestHandlers
{
	public class GetBorrower : Albatross.ServerSide.Messaging.RequestHandler<Samples.Contract.RequestsAndResponses.GetBorrowerI>
	{
		public override Albatross.Common.Messaging.Response Handle( Samples.Contract.RequestsAndResponses.GetBorrowerI request )
		{
			var response = new Samples.Contract.RequestsAndResponses.GetBorrowerO();
			response.MyBorrower = new Samples.Entities.Borrower()
			{
				FirstName = "Marilyn",
				LastName = "Manson"
			};



			OperationContext context = OperationContext.Current;
			response.MyBorrower.FirstName = ( ( RemoteEndpointMessageProperty )context.IncomingMessageProperties[ RemoteEndpointMessageProperty.Name ] ).Address.ToString();
			return response;
		}
	}

}
